package com.example.moveclock.activities;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.AnalogClock;

public class FirstGameActivity extends Activity {
	static final String STARTS_COUNT = "startsCount";
	int startsCount = 0;
	@Override
	public void onSaveInstanceState(Bundle savedInstanceState) {
	    // Save the user's current game state
	    savedInstanceState.putInt(STARTS_COUNT, startsCount + 1);
	    super.onSaveInstanceState(savedInstanceState);
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_first_game);
		
	}
	
	@Override
	public void onResume(){
		super.onResume();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}


	public void up(View view) {
		AnalogClock clock = (AnalogClock) findViewById(R.id.analogClock1);
		Log.d("upmethod", "clock.getTop() " + clock.getTop());
		clock.layout(clock.getLeft(), 
				clock.getTop() - 10, 
				clock.getRight(), 
				clock.getBottom() - 10);
	}

	public void down(View view) {
		
		AnalogClock clock = (AnalogClock) findViewById(R.id.analogClock1);
		clock.layout(clock.getLeft(), 
				clock.getTop() + 10, 
				clock.getRight(), 
				clock.getBottom() + 10);
	}

	public void left(View view) {
		AnalogClock clock = (AnalogClock) findViewById(R.id.analogClock1);
		clock.layout(clock.getLeft() - 10, 
				clock.getTop(), 
				clock.getRight() - 10, 
				clock.getBottom());
	}

	public void right(View view) {
		AnalogClock clock = (AnalogClock) findViewById(R.id.analogClock1);
		clock.layout(clock.getLeft() + 10, 
				clock.getTop(), 
				clock.getRight() + 10, 
				clock.getBottom());
		
	}
	
	public void exit(View view) {
		Log.d("upmethod", "perform exit");
		onDestroy();
		closeContextMenu();
		closeOptionsMenu();
		this.finish();
	}
}